package com.kangye.learnstudent.service.impl;


import com.kangye.learnstudent.entity.StudentPaper;
import com.kangye.learnstudent.entity.Subject;
import com.kangye.learnstudent.entity.User;

import com.kangye.learnstudent.entity.Subject;

import com.kangye.learnstudent.mapper.SubjectMapper;
import com.kangye.learnstudent.service.SubjectService;
import com.kangye.learnstudent.util.ViewJsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: learndeduo
 * @description: 实现学科逻辑接口
 * @author: 索腾龙
 * @create: 2021-05-17 11:07
 **/
@Service
@Transactional
public class SubjectServiceImpl implements SubjectService {
    @Autowired
    private SubjectMapper subjectMapper;

    //查询所有的课程名
    @Override
    public List<Subject> getSubject(User user) {
        List<Subject> list = subjectMapper.getSubject(user);
        if (list.size()>0){
            return list;
        }
        return null;
    }


    //根据年级查询各个学科
    @Override
    public ViewJsonObject<Subject> selSubject(Integer subjectGradeId) {
        List<Subject> list = subjectMapper.selSubject(subjectGradeId);
        return new ViewJsonObject<>(list);
    }

}